//#define max(a, b) ((a) > (b)? (a): (b))

struct incall_reg {
	unsigned int reg;
	unsigned int val;
};

static unsigned int cache_size = 0;
static struct incall_reg *cache;
static int cache_path = -1;
static int calling_flag = 0;
static struct incall_reg *cur_incall_reg = NULL;

static struct incall_reg incall_spk_reg[] = {
	{0x0204, 0x0019},
	{0x0211, 0x0009},
	{0x0310, 0x4118},
	{0x0312, 0x0000},
	{0x0311, 0x0100},
	{0x0601, 0x0004},
	{0x0602, 0x0004},
	{0x0036, 0x0003},
	{0x0024, 0x0011},
	{0x0610, 0x01C0},
	{0x0611, 0x01C0},
	{0x0612, 0x01C0},
	{0x0613, 0x01C0},
	{0x0502, 0x01C0},
	{0x0503, 0x01C0},
	{0x0022, 0x0000},
	{0x0023, 0x0000},
	{0x0026, 0x017C},
	{0x0027, 0x017C},
	{0x0025, 0x0164},
	{0x0028, 0x0030},
	{0x0029, 0x0020},
	{0x0621, 0x0000},
	{0x0604, 0x0010},
	{0x0605, 0x0010},
	{0x0018, 0x010B},
	{0x0029, 0x0030},
	{0x0603, 0x000C},
	{0x0500, 0x01C0},
	{0x0501, 0x01C0},
	{0x003A, 0x0002},
	{0x0200, 0x0001},
	{0x0208, 0x001F},
	{0x0001, 0x3013},
	{0x0002, 0x0240},
	{0x0003, 0x0300},
	{0x0004, 0x3003},
	{0x0005, 0x3003},
	{0x0006, 0x0000},
	{0x0520, 0x0000},
};
static struct incall_reg incall_hp_reg[] = {
	{0x0204, 0x0019},
	{0x0211, 0x0009},
	{0x0310, 0x4118},
	{0x0208, 0x000F},
	{0x0312, 0x0000},
	{0x0311, 0x0100},
	{0x002D, 0x0100},
	{0x002E, 0x0100},
	{0x0601, 0x0004},
	{0x0602, 0x0004},
	{0x0036, 0x0000},
	{0x0610, 0x01C0},
	{0x0611, 0x01C0},
	{0x0612, 0x01C0},
	{0x0613, 0x01C0},
	{0x0502, 0x01C0},
	{0x0503, 0x01C0},
	{0x001C, 0x01ea},
	{0x001D, 0x01ea},
	{0x0020, 0x01F9},
	{0x0021, 0x01F9},
	{0x0025, 0x0164},
	{0x0028, 0x0003},
	{0x002A, 0x0020},
	{0x0621, 0x0000},
	{0x0604, 0x0020},
	{0x0605, 0x0020},
	{0x001A, 0x010B},
	{0x002A, 0x0030},
	{0x0603, 0x0180},
	{0x0500, 0x01C0},
	{0x0501, 0x01C0},
	{0x003A, 0x0002},
	{0x003B, 0x000D},
	{0x003C, 0x0003},
	{0x0200, 0x0001},
	{0x0208, 0x001F},
	{0x0051, 0x0005},
	{0x0060, 0x0022},
	{0x004C, 0x9F25},
	{0x0055, 0x0541},
	{0x0055, 0x0401},
	{0x0054, 0x0303},
	{0x0057, 0xFBFB},
	{0x0054, 0x000F},
	{0x0060, 0x00EE},
	{0x0001, 0x0323},
	{0x0002, 0x0110},
	{0x0003, 0x0000},
	{0x0004, 0x3003},
	{0x0005, 0x3003},
	{0x0006, 0x0000},
	{0x0520, 0x0000},
};

static struct incall_reg incall_bt_reg[] = {
	{0x0204, 0x0019},
	{0x0211, 0x0009},
	{0x0310, 0x4118},
	{0x0208, 0x000F},
	{0x0312, 0x0000},
	{0x0311, 0x0100},
	{0x0006, 0x0014},
	{0x0502, 0x01C0},
	{0x0503, 0x01C0},
	{0x0200, 0x0001},
	{0x0204, 0x0001},
	{0x0001, 0x0003},
	{0x0002, 0x0000},
	{0x0003, 0x0000},
	{0x0004, 0x3000},
	{0x0005, 0x3000},
	{0x0520, 0x0000},
};
